﻿using Application.Dto;
using Application.IAppSrevices;
using AutoMapper;
using Domain.Entitys;
using Domain.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.AppSrevices
{
    public class CPCService : ICPCService
    {
        private readonly IMapper mapper;
        private readonly ICPCRepositoy  cPCRepositoy;

        public CPCService(ICPCRepositoy cPCRepositoy, IMapper mapper)
        {
            this.cPCRepositoy = cPCRepositoy;
            this.mapper = mapper;
        }
        /// <summary>
        ///分页 数据显示
        /// </summary>
        /// <param name="cPC"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public  async Task<List<CPC>> CPCselectAsync(int pageIndex, int pageSize)
        {
            return await cPCRepositoy.CPCselectAsync(pageIndex, pageSize);
        }
        /// <summary>
        /// 总共页数
        /// </summary>
        /// <returns></returns>
        public int SelectCount()
        {
            return cPCRepositoy.SelectCount();
        }
        /// <summary>
        /// 公共字段设置添加
        /// </summary>
        /// <param name="cPCAdd"></param>
        /// <returns></returns>
        public async Task<int> CPCAddAsync(CPCAdd  cPCAdd) {
           CPC cPC=mapper.Map<CPC>(cPCAdd);
            return await cPCRepositoy.CPCAddAsync(cPC);
        }
        /// <summary>
        /// 公共字段设置删除
        /// </summary>
        /// <param name="cPC"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<int> CPCDeleteAsync(CPCDelete  cPCDelete)
        {
            CPC cPC = mapper.Map<CPC>(cPCDelete);
            return  await  cPCRepositoy.CPCDeleteAsync(cPC);
        }
        /// <summary>
        /// 按条件查询
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
   /*     public async Task<List<CPC, int totalRecordCount>> CPCselectaAsync(int pageIndex, int pageSize,string name )
        {
            return await cPCRepositoy.CPCselectaAsync(pageIndex, pageSize,name);
        }*/

       public async Task <List<CPC>>  CPCselectaAsync(int pageIndex, int pageSize, string name)
        {
            return await cPCRepositoy.CPCselectaAsync(pageIndex, pageSize, name);
        }

        public  int SelectCounta(string name)
        {
            return  cPCRepositoy.SelectCounta(name);
        }
        /// <summary>
        /// 薪酬管理设置添加
        /// </summary>
        /// <param name="cPCAdd"></param>
        /// <returns></returns>
        public Task<int> CPCxianz(CPCAdd cPCAdd)
        {
            CPC cPC= mapper.Map<CPC>(cPCAdd);
            return  cPCRepositoy.CPCxinz(cPC);
        }

        /// <summary>
        /// 使用属性种类查询全部属性数据
        /// </summary>
        /// <param name="kind"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<List<CPC>> CPCFillAsync(string kind)
        {
            return cPCRepositoy.CPCFillAsync(kind);
        }
    }
}
